import router from '@system.router';
export default {
    data: {
        index: 0,
        sort: [
            {id: 0, name: "精选分类", sortName: "choice"},
            {id: 1, name: "女鞋", sortName: "female"},
            {id: 2, name: "男鞋", sortName: "male"},
            {id: 3, name: "童鞋", sortName: "kid"}
        ],
        showTypeList: [],
        shoes: [
            {id: 1,gender: "female", tname: "运动鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimgservice.suning.cn%2Fuimg1%2Fb2c%2Fimage%2FHkk4aB0TJZeCsdnqeDS1sw.jpg_800w_800h_4e&refer=http%3A%2F%2Fimgservice.suning.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669546242&t=bced386cecabf3a52fe06b4b3f23b1ea",choice: "false"},
            {id: 2,gender: "female", tname: "高跟鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fi3%2F2207657130275%2FO1CN01oz5iWx1DtzbmxDASa_%21%212207657130275.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669549404&t=a255ce4d2cbe3c8554b12dbd19cfbd53", choice: "true"},
            {id: 3,gender: "female", tname: "帆布鞋", img: "https://img2.baidu.com/it/u=3213204556,2284148075&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500", choice: "false"},
            {id: 4,gender: "female", tname: "小白鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fg-search1.alicdn.com%2Fimg%2Fbao%2Fuploaded%2Fi4%2F2211403712621%2FO1CN017vm7JN1VESnaDZNZC_%21%212211403712621.jpg_300x300.jpg&refer=http%3A%2F%2Fg-search1.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669546818&t=6d22827132dd09ef7f96cd8711336b28", choice: "true"},
            {id: 5,gender: "female", tname: "马丁靴", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fkaola-pop.oss.kaolacdn.com%2F5d7a897863294139a8f9f4e4be21b917_800_800.jpg%3Fx-oss-process%3Dimage%2Fresize%2Cw_262%2Ch_262%2Fquality%2Cq_90&refer=http%3A%2F%2Fkaola-pop.oss.kaolacdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669549779&t=a6420efdc06612cdec51fcd2e5bf3766", choice: "true"},
            {id: 6,gender: "female", tname: "老爹鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic12.secooimg.com%2Fimgextra%2F1%2F4Cwf%2F10%2F48%2F206dPsf0128319810c481f9924d46e79366e2d.jpg&refer=http%3A%2F%2Fpic12.secooimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669547090&t=52cdcabd1c31132acd6b2054409bdcf4",choice: "true"},
            {id: 7,gender: "female", tname: "女士凉鞋", img: "https://img1.baidu.com/it/u=3370712319,103389454&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500", choice: "false"},
            {id: 8, gender: "male", tname: "运动鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fqny.smzdm.com%2F202209%2F17%2F6324ae62ba56f5816.jpg_d250.jpg&refer=http%3A%2F%2Fqny.smzdm.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669547287&t=91baca21ab4dfc7663e71364ba970e35", choice: "false"},
            {id: 9, gender: "male", tname: "皮鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fi1.ygimg.cn%2Fpics%2Fbelle%2F2014%2F100050894%2F100050894_01_l.jpg%3F2&refer=http%3A%2F%2Fi1.ygimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669558998&t=fd39f623cafaa3b43d03b56fa3afb177", choice: "true"},
            {id: 10,gender: "male",  tname: "休闲鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fqny.smzdm.com%2F202209%2F16%2F632436dd3519d881.jpg_d250.jpg&refer=http%3A%2F%2Fqny.smzdm.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669547599&t=f56c22414654cc61e7a0513464a4c470",choice: "true"},
            {id: 11,gender: "male",  tname: "小白鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fgfs17.gomein.net.cn%2FT1cYAVByYv1RCvBVdK_800.jpg%3Fv%3D2&refer=http%3A%2F%2Fgfs17.gomein.net.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669547674&t=596d82d010befe7501bd971344bc7ca9", choice: "false"},
            {id: 12,gender: "male",  tname: "网面鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.alicdn.com%2Fi2%2F1044611358%2FO1CN01Z1sBXY1Lu0Nm6cbV0_%21%211044611358.jpg&refer=http%3A%2F%2Fimg.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669559479&t=1fc311a7319f0a9376223ba3d3e890c2", choice: "false"},
            {id: 13,gender: "male",  tname: "帆布鞋", img: "https://img2.baidu.com/it/u=2074877082,1755092455&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500", choice: "true"},
            {id: 15,gender: "kid", tname: "儿童运动鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fy.zdmimg.com%2F202012%2F16%2F5fd987c0d054b8710.jpg_d250.jpg&refer=http%3A%2F%2Fy.zdmimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669560054&t=3d8b74549dd723364268a8873818e1e8",choice: "false"},
            {id: 16,gender: "kid", tname: "学步鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.pconline.com.cn%2Fimages%2Fupload%2Fupc%2Ftx%2Fpc_best%2F2210%2F19%2Fc109%2F338339376_1666162651247_255x255.jpg&refer=http%3A%2F%2Fimg.pconline.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669548527&t=e3fd78f41297f57accc328c3455e5441", choice: "true"},
            {id: 17,gender: "kid", tname: "跑鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg10.360buyimg.com%2Fn1%2Fjfs%2Ft1%2F180511%2F29%2F6540%2F93729%2F60b2db57E6bdb7d59%2Fe650222dc05ea3c0.jpg&refer=http%3A%2F%2Fimg10.360buyimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669548580&t=45a8792fb847acfbfceee8ee24d61763", choice: "false"},
            {id: 18,gender: "kid", tname: "儿童休闲鞋", img: "https://img0.baidu.com/it/u=1495375414,4002900198&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500", choice: "true"},
            {id: 19,gender: "kid", tname: "儿童帆布鞋", img: "http://t15.baidu.com/it/u=3796459873,2792765711&fm=224&app=112&f=JPEG?w=500&h=500",choice: "true"},
            {id: 20,gender: "kid", tname: "凉鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimgservice.suning.cn%2Fuimg1%2Fb2c%2Fimage%2FO4IRL10lx41RaNkZTl5rpQ.jpg_800w_800h_4e&refer=http%3A%2F%2Fimgservice.suning.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669560508&t=88beab399e301ed05a971b6daf63d967",choice: "false"},
            {id: 21,gender: "kid", tname: "毛毛虫鞋", img: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.pconline.com.cn%2Fimages%2Fupload%2Fupc%2Ftx%2Fpc_best%2F2102%2F04%2Fc5%2F252464668_1612370017113_255x255.jpg&refer=http%3A%2F%2Fimg.pconline.com.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1669548978&t=72bc879faad1437f4605eff8d3bf0561",choice: "false"},
            {id: 22,gender: "kid", tname: "户外鞋", img: "https://img0.baidu.com/it/u=4157638571,1391974222&fm=253&fmt=auto&app=138&f=JPEG?w=350&h=350", choice: "false"},
            {id: 3,gender: "female", tname: "洞洞鞋", img: "https://img14.360buyimg.com/pop/jfs/t1/178350/36/26696/50521/62d22437Ed9791861/c4249aa71144808f.jpg", choice: "false"},
        ],

    },

    change: function(e) {
        this.showTypeList = [];
        this.index = e.index;
        if(this.index == 0) {
            for (let i = 0; i < this.shoes.length; i++) {
                for(let key in this.shoes[i]) {
                    if (this.shoes[i]['choice'] == "true") {
                        this.showTypeList.push(this.shoes[i]);
                        break;
                    }

                }
            }
        } else {
            for(let i = 0; i < this.shoes.length; i++) {
                for(let key in this.shoes[i]){
                    if(this.shoes[i]['gender'] == this.sort[this.index].sortName){
                        this.showTypeList.push(this.shoes[i]);
                        break;
                    }
                }
            }
        }
//
    },
    changeIndex(index) {
        this.showTypeList = [];
        this.index = index;
        if(this.index == 0) {
            for (let i = 0; i < this.shoes.length; i++) {
                for(let key in this.shoes[i]) {
                    if (this.shoes[i]['choice'] == "true") {
                        this.showTypeList.push(this.shoes[i]);
                        break;
                    }
                }

            }
        }  else {
            for(let i = 0; i < this.shoes.length; i++) {
                for(let key in this.shoes[i]){
                    if(this.shoes[i]['gender'] == this.sort[this.index].sortName){
                        this.showTypeList.push(this.shoes[i]);
                        break;
                    }
                }
            }
        }
    },
    onInit() {
        for (let i = 0; i < this.shoes.length; i++) {
            for(let key in this.shoes[i]) {
                if (this.shoes[i]['choice'] == "true") {
                    this.showTypeList.push(this.shoes[i]);
                    break;
                }
            }
        }
    },
    goShoesList(tname, gender){
        router.push({
            uri: 'pages/shoes/shoes',
            params: {
                categoryName: tname,
                gender: gender
            }
        })
    }

}
